<template>
	<view class="page">
		<image class="img" :src="img" mode="scaleToFill"></image>
		<view class="time" @click="onPage">
			跳过{{time}}s
		</view>
	</view>
</template>

<script>
	import { getStartup } from '@/utils/getRequest.js'
	export default {
		data(){
			return{
				img:"",
				time:3,
				timeFUN:null
			}
		},
		methods:{
			async getInfo(){
				try{
					var res = await getStartup()
					this.img = res
				}catch{}
				this.time = 2
				this.timeFUN = setInterval(() => {
					if (this.time === 1) {
						if (this.timeFUN) clearInterval(this.timeFUN)
						uni.reLaunch({
							url:'/pages/index/index'
						})
					} else {
						this.time = this.time - 1
					}
				}, 1000)
				
			},
			onPage(){
				if (this.timeFUN) clearInterval(this.timeFUN)
				uni.reLaunch({
					url:'/pages/index/index'
				})
			},
		},
		onLoad(){
			this.getInfo()
		},
		
	}
</script>

<style lang="scss" scoped>
	.page{
		width: 750rpx;
		height: 100vh;
		position: relative;
		.img{
			width: 750rpx;
			height: 100vh;
		}
		.time{
			position:absolute;
			right: 30rpx;
			bottom: 100px;
			font-size: 26rpx;
			color:#fff;
			line-height: 50rpx;
			height: 50rpx;
			padding: 0 30rpx;
			border-radius: 25rpx;
			background-color: #BBBBBB;
		}
	}
</style>
